Skip to main content
Version: Preview

SQL Server

Experimental
Creates:
AssetsLineage

Configure in the UI

This plugin can be configured directly in the Marmot UI with a step-by-step wizard.

View Guide

The SQL Server plugin discovers databases, tables, views, stored procedures and functions from Microsoft SQL Server, Azure SQL Database and Azure SQL Edge instances. It uses the pure-Go github.com/microsoft/go-mssqldb driver, so no ODBC driver is needed on the host. SQL authentication works with a plain login, and Windows authentication works by giving the login as DOMAIN\user.

Databases and Naming

A SQL Server session is bound to a single database, so the plugin opens one connection per database. By default it discovers every database the login can open, minus master, model, msdb and tempdb. Set database to discover just one.

One instance holds many databases and two of them can hold the same schema and object name, so tables, views and routines are named database.schema.object. Databases are named by themselves.

Lineage

A database gets a CONTAINS edge to every table, view and routine it holds. Foreign keys become FOREIGN_KEY edges from the referencing table to the referenced one. View definitions are scanned for the objects they read, which become VIEW_OF edges from each base object to the view.

Query history is not read. Usage-based lineage would need the plan cache or Query Store, which are per-database, expensive to scan and often disabled.

Encryption

encrypt: true requires an encrypted connection. A default SQL Server install presents a self-signed certificate, which fails verification, so pair it with trust_server_certificate: true or install a certificate the client trusts. encrypt: false turns encryption off entirely.

Comments

SQL Server has no COMMENT ON, so descriptions come from MS_Description extended properties on schemas, tables, views and columns. Objects without one have no description.

Example Configuration


host: "sqlserver.company.com"
port: 1433
user: "marmot_reader"
password: "secure_password_123"
encrypt: true
trust_server_certificate: false
exclude_databases:
- "master"
- "model"
- "msdb"
- "tempdb"
tags:
- "sqlserver"
- "production"

Configuration

The following configuration options are available:

PropertyTypeRequiredDescription
application_intentstringfalseConnect to a read-only replica with ReadOnly
connect_timeout_secondsintfalseSeconds to wait for a connection
databasestringfalseDiscover only this database. Leave empty to discover every database the login can open
discover_foreign_keysboolfalseWhether to discover foreign key relationships
encryptboolfalseRequire an encrypted connection
exclude_databases[]stringfalseDatabases to skip
exclude_schemas[]stringfalseSchemas to skip
external_links[]ExternalLinkfalseExternal links to show on all assets
filterFilterfalseFilter discovered assets by name (regex)
hoststringtrueSQL Server hostname or IP address
include_columnsboolfalseWhether to include column information
include_proceduresboolfalseWhether to discover stored procedures and functions
include_statisticsboolfalseWhether to collect row counts and table sizes
include_viewsboolfalseWhether to discover views
passwordstringtruePassword for the login
portintfalseSQL Server port
tagsTagsConfigfalseTags to apply to discovered assets
trust_server_certificateboolfalseAccept the server certificate without verifying it. Needed for self-signed certificates
userstringtrueLogin to authenticate with. Use DOMAIN\user for Windows authentication

Available Metadata

The following metadata fields are available:

FieldTypeDescription
collationstringDatabase collation, or column collation for text types
column_namestringColumn name
commentstringMS_Description extended property on the object
computed_definitionstringExpression a computed column is derived from
createdstringWhen the object was created
data_typestringColumn type as SQL Server declares it, for example nvarchar(100) or decimal(10,2)
databasestringDatabase holding the object
database_idintDatabase id within the instance
default_expressionstringDefault constraint expression
descriptionstringMS_Description extended property on the column
editionstringInstance edition
encryptedboolWhether the routine body is encrypted and so unreadable
hoststringSQL Server hostname or IP address
identity_incrementint64Step between IDENTITY values
identity_seedint64First value an IDENTITY column produces
is_computedboolWhether the column is computed from other columns
is_identityboolWhether the column is an IDENTITY column
is_nullableboolWhether null values are allowed
is_persistedboolWhether a computed column is stored rather than evaluated on read
is_primary_keyboolWhether the column is part of the primary key
modifiedstringWhen the object was last altered
object_typestringObject type (user_table, view) or routine type (stored_procedure, scalar_function, inline_table_function, table_function)
ownerstringLogin that owns the database
portintSQL Server port
recovery_modelstringRecovery model (SIMPLE, FULL, BULK_LOGGED)
schemastringSchema holding the object
schema_commentstringMS_Description extended property on the schema
schema_countintNumber of discovered schemas
server_versionstringInstance product version
statestringDatabase state, always ONLINE for a discovered database
table_countintNumber of discovered tables
table_namestringTable or view name, without the database and schema
view_countintNumber of discovered views